<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="/tld/extremecomponents" prefix="ec" %>
<%@ include file="../../common/common.jsp" %>	
<%@ include file="master_pass.jsp" %>
<%
masterLogin.hasPermission(4001);
//权限判断代码结束
String loginId = Utility.trimNull(request.getParameter("loginId"));
String userName = Utility.trimNull(request.getParameter("userName"));
String trueName = Utility.trimNull(request.getParameter("trueName"));
String email = Utility.trimNull(request.getParameter("email"));
String gradeId = Utility.trimNull(request.getParameter("gradeId"));

IUserService userService = (IUserService)BeanManager.getBean("userService");
userService.AutoBindingTable(request);
%>
<html>
<head>
<title><%=SYSTITLE%> - 社区用户信息管理</title>
<%@ include file="../../common/meta.inc" %>
<link href="css.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/extremetable/extremecomponents.css"/>
<SCRIPT LANGUAGE="javascript" SRC="${pageContext.request.contextPath}/scripts/common-validator.js"></SCRIPT>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/prototype.js"></script>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/buffalo/buffalo.js"></script>
<script language="javascript">
var END_POINT="${pageContext.request.contextPath}/buffalo";
var buffalo = new Buffalo(END_POINT);

function updateInfo(id)
{
	location = "user_update.jsp?userId="+id;	
}

function showInfo(id)
{
	location = "user_info.jsp?userId="+id;	
}

function updatePass(id)
{
	sl_alert("该功建设中...");
}


function deleteInfo(id)
{
	if(!sl_confirm('删除选定的记录')) return false;	
	
	var obj = parseInt(id);
	buffalo.remoteCall("userServiceAjaxService.deleteLogic",[obj], function(reply) {
        ajaxSubmit(reply.getResult(),"删除成功！","reload");	
    });
}

function resumeInfo(id)
{
	if(!sl_confirmResume(id))
		return;		
	
	var obj = parseInt(id);
	buffalo.remoteCall("userServiceAjaxService.doResumeLogic",[obj], function(reply) {
         ajaxSubmit(reply.getResult(),"恢复成功！","reload");
    });
}
</script>
</head>
<body leftMargin=5 topMargin=10 rightmargin="0" bottommargin="0" >
<table width="99%" border="0" align="center" cellpadding="2" cellspacing="2" bgcolor="#e6e6e6">
  <tr>
    <td align="center"><strong>配置社区用户信息</strong></td>
  </tr>
</table>
<form name="theform" method="get" action="user.jsp">
<table width="100%" border="0" align="center" cellpadding="4" cellspacing="1">
<tr>
	<td align="right">用户名:</td>
	<td align="left">
		<input type="text" name="loginId" id="loginId" size="16" maxlength="50" value="<%=loginId%>">
	</td>
	<td align="right">昵称:</td>
	<td align="left">
		<input type="text" name="userName" id="userName" size="16" maxlength="50" value="<%=userName%>">
	</td>
	<td align="right">真实姓名:</td>
	<td align="left">
		<input type="text" name="trueName" id="trueName" size="16" maxlength="50" value="<%=trueName%>">
	</td>
	<td align="right">用户等级:</td>
	<td align="left">
		<select size="1" name="gradeId" id="gradeId">
			<%=Arguments.getUserGradeOptions(Utility.parseInt(gradeId))%>
		</select>
	</td>
	<td><button class="btn" id="btnQuery" name="btnQuery" title="查询" onclick="javascript:document.theform.submit();">查询</button></td>
</tr>
</table>
	<ec:table 
		items="resultList"
		var="rs"	
		retrieveRowsCallback="limit"
        sortRowsCallback="limit"			
		action="${pageContext.request.contextPath}/club/admin/user.jsp"		
		title="社区用户信息"
		form="theform"
		>	
		<ec:parameter name="loginId" value="<%=loginId %>"></ec:parameter>
		<ec:parameter name="userName" value="<%=userName %>"></ec:parameter>
		<ec:parameter name="trueName" value="<%=trueName %>"></ec:parameter>
		<ec:parameter name="email" value="<%=email %>"></ec:parameter>
		<ec:parameter name="gradeId" value="<%=gradeId %>"></ec:parameter>
		<ec:row>
				<ec:column property="LOGIN_ID" title="用户名"/>
				<ec:column property="USER_NAME" title="昵称">
					${rs.USER_NAME }(${rs.SEX })
				</ec:column>
				<ec:column property="TRUE_NAME" title="真实姓名" />				
				<ec:column property="REG_TIME" title="注册时间" />
				<ec:column property="REG_IP" title="注册IP" />
				<ec:column property="LAST_LOGIN_TIME" title="最后登陆时间" />
				<ec:column property="LOGIN_TIMES" title="登陆次数" />
				<ec:column property="USER_TOPIC_COUNT" title="发/回帖" sortable="false">
					${rs.USER_TOPIC_COUNT}/${rs.USER_RE_COUNT}
				</ec:column>
				<ec:switchColumn property="ISDEL_FLAG" title="操作"  defaultValues="false,true" sortable="false" viewsAllowed="html">
					<input type="button" name="btnDelete" value="删除" onclick="javascript:deleteInfo(${rs.USER_ID})">	
					||
					<input type="button" name="btnResume" value="恢复" onclick="javascript:resumeInfo(${rs.USER_ID})">	
				</ec:switchColumn>				
				<ec:column property="1" title="操作" width="13%" sortable="false" viewsAllowed="html">
					<input type="button" name="btnEdit" value="编辑"
						onclick="javascript:updateInfo(${rs.USER_ID})">
					&nbsp;
					<input type="button" name="btnInfo" value="查看"
						onclick="javascript:showInfo(${rs.USER_ID})">
					<br>
					&nbsp;
					<input type="button" name="btnEditPass" value="重置密码"
						onclick="javascript:updatePass(${rs.USER_ID})">
					<br>			
				</ec:column>
			</ec:row>
	</ec:table>
</form>		
			<table border="0" width="100%">
				<tr valign="top">
					<td align="right">
					<button class="btn" accessKey=r id="btnRefresh" name="btnRefresh" title="刷新当前页面" onclick="javascript:location.reload();this.disabled=true;">刷新(<u>R</u>)</button>
					&nbsp;&nbsp;&nbsp;<td>
				</tr>
			</table>
			
</body>
</html>
